Practice Problems on Pointers in C++
Posted on December 18, 2023 by Vishesh Namdev
Python
C
C++
Java
Basic Practice Problems based on chapter which you learn in previous Tutorials.
#include <iostream>
int main() {
// Declare variables to store the two numbers
double num1, num2;
// Input the two numbers
std::cout << "Enter the first number: ";
std::cin >> num1;
std::cout << "Enter the second number: ";
std::cin >> num2;
// Perform addition
double sum = num1 + num2;
// Display the result
std::cout << "Sum: " << sum << std::endl;
return 0;
}
int main() {
// Declare variables to store the two numbers
double num1, num2;
// Input the two numbers
std::cout << "Enter the first number: ";
std::cin >> num1;
std::cout << "Enter the second number: ";
std::cin >> num2;
// Perform addition
double sum = num1 + num2;
// Display the result
std::cout << "Sum: " << sum << std::endl;
return 0;
}